﻿using Unity.Entities;
using UnityEngine;

public class ArrowSpawnerAuthoring : MonoBehaviour
{
    public GameObject preFab;
    public int MaxCount;

    public class Baker : Baker<ArrowSpawnerAuthoring>
    {
        public override void Bake(ArrowSpawnerAuthoring authoring)
        {
            Entity entity = GetEntity(TransformUsageFlags.None); // 最基本entity
            AddComponent(entity,new ArrowSpawner
            {
                preFab = GetEntity(authoring.preFab,TransformUsageFlags.Dynamic),
                MaxCount = authoring.MaxCount
            });
        }
    }
}

public struct ArrowSpawner : IComponentData
{
    public Entity preFab;
    public int MaxCount;
}